﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class admin_manageCopyright : System.Web.UI.Page
{
    db_copyright cr = new db_copyright();
    protected void Page_Load(object sender, EventArgs e)
    {
        Server.Execute("inc/checkPurview.aspx");  // 此处用户权限验证
        if (!IsPostBack) { 
            DataSet ds=cr.selectOne();
            if(ds.Tables[0].Rows.Count==0){
                return;
            }
            tb_year.Text = ds.Tables[0].Rows[0]["cryear"].ToString();
            tb_owner.Text = ds.Tables[0].Rows[0]["owner"].ToString();
            tb_app.Text = ds.Tables[0].Rows[0]["approve"].ToString();
            
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string year = tb_year.Text.Trim();
        string owner = tb_owner.Text.Trim();
        string app = tb_app.Text.Trim();
        if (cr.updateCr(year, owner, app))
        {
            Response.Write("<script language=javascript>alert('更新成功！');</script>");
        }
        else {
            Response.Write("<script language=javascript>alert('失败！');</script>");
        }
    }
}